unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ChildWin, DB, ADODB, DBCtrls, Mask, StdCtrls, ActnList;

type
  TDescription = class(TMDIChild)
    etatCivilGroupBox: TGroupBox;
    nomLabel: TLabel;
    DBText1: TDBText;
    prenomLabel: TLabel;
    adresseLabel: TLabel;
    numEtuLabel: TLabel;
    DBText2: TDBText;
    DBText3: TDBText;
    telephoneLabel: TLabel;
    telephoneDBEdit: TDBEdit;
    adresseDBMemo: TDBMemo;
    etuTable: TADOTable;
    EtuSource: TDataSource;
    validerButton: TButton;
    annulerButton: TButton;
    modifierButton: TButton;
    ActionList1: TActionList;
    Modifier: TAction;
    Annuler: TAction;
    Valider: TAction;
    filterSelector: TAction;
    procedure ValiderExecute(Sender: TObject);
    procedure ModifierExecute(Sender: TObject);
    procedure filterSelectorExecute(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Description: TDescription;

implementation

uses Main;

{$R *.dfm}

procedure TDescription.filterSelectorExecute(Sender: TObject);
//var text: string;
begin
  inherited;
  //ShowMessage('test');
  //text := MainForm.getIdentifiantCourant;
  etuTable.Filter := 'numEtu = '+MainForm.getIdentifiantCourant;
end;

procedure TDescription.FormDestroy(Sender: TObject);
begin
  inherited;
     MainForm.setDescriptionTerminated(true);
end;

procedure TDescription.ModifierExecute(Sender: TObject);
begin
  inherited;
  modifierButton.Enabled := false;
  validerButton.Enabled := true;

  adresseDBMemo.Color := clWindow;
  telephoneDBEdit.Color := clWindow;

  adresseDBMemo.ReadOnly := false;
  telephoneDBEdit.ReadOnly := false;
end;

procedure TDescription.ValiderExecute(Sender: TObject);
begin
  inherited;
  modifierButton.Enabled := true;
  validerButton.Enabled := false;

  adresseDBMemo.ParentColor := true;
  telephoneDBEdit.ParentColor := true;

  adresseDBMemo.ReadOnly := true;
  telephoneDBEdit.ReadOnly := true;
end;

end.
